const { defineConfig } = require('@vue/cli-service')
const {webpackDevCofnig} = require('./webpack.config.dev')
const {webpackProdCofnig} = require('./webpack.config.prod')
const path = require('path')
module.exports = defineConfig({
  lintOnSave: false,//关闭eslint检查
  transpileDependencies: true,
  /**
   * 导出一个配置对象，会和webpack的配置对象进行合并
   * 合并策略：
   * 1. 如果是数组，会合并数组，去重
   * 2. 如果是对象，会合并对象，属性覆盖
   * 3. 如果是其他类型，会覆盖
   * @returns {Object} 配置对象
   */

  configureWebpack(){ 
    if(process.env.NODE_ENV === 'development'){
      console.log('开发环境启动...')
      return {
        ...webpackDevCofnig
      }
    }else{
      console.log('生产环境启动...')
    return {
      ...webpackProdCofnig
    }
  }
  }
})